<script>
    function IsEmail(email) {
        var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
        return regex.test(email);
    }
    
    function VerifyEmail(email){
        email = encodeURIComponent(email);
        url_link = "<?php echo site_url()."/user_group3/signup/verify_email/"?>"+email;
        $.ajax({
            url : url_link,
            type: 'post',
            async: false,
            success: function(data){
                isUnique = data;
            } 
        });
        if(isUnique == 0){
            return false;
        }
        else{
            return true;
        }
    }
    
    function checkFileName(filename){
        var a = filename.split(".");
        if( a.length === 1 || ( a[0] === "" && a.length === 2 ) ) {
            return "";
        }
        var ext = a.pop();
        ext = ext.toLowerCase();
        if(ext == "jpg"  || ext == "png" || ext =="jpeg" || ext == "bmp"){
            return true;
        }
        else{
            return false;
        }
    }

    /*Check website */
    function is_valid_url(url)
     {
         return url.match(/^((ht|f)tps?:\/\/)|(www)[a-z0-9-\.]+\.[a-z]{2,4}\/?([^\s<>\#%"\,\{\}\\|\\\^\[\]`]+)?$/);
     }

    function IsPasswordValid(password) {
       var passw = /(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,}/;
       return passw.test(password);
    }

    function md5(password){
        url_link = "<?php echo site_url()."/user_group3/signup/md5?password="?>"+password;
        $.ajax({
            url : url_link,
            type: 'post',
            async: false,
            success: function(data){
                pass_md5 = data;
            } 
        });
        return pass_md5;
    }
</script>